<template>
  <view>
    <wd-navbar
        :safeAreaInsetTop="true"
        :bordered="false"
        :custom-style="`background: ${props.navBarBgc};`"
    >
      <template #left>
        <wd-icon name="thin-arrow-left" size="18px" @click="pageBack(currentPageNumber)"></wd-icon>
      </template>
      <template #title>
        <view class="nav-title">{{props.title}}</view>
      </template>
    </wd-navbar>
  </view>
</template>

<script setup>
  import {onLoad} from "@dcloudio/uni-app";
  import {ref} from "vue";
  import {useMixin} from "@/hook/useMixin";

  const { pageBack } = useMixin();
  const props = defineProps({
    title: {
      default:"",
      type: String
    },
    currentPageNumber:{
      default:1,
      type: Number
    },
    navBarBgc:{
      default:"linear-gradient(180deg, rgba(169,195,175,1) 0%, rgba(194,211,190,1) 31%, rgba(237,240,223,1) 100%)",
      type: String

    }
  });

  const currentPageNumber = ref(1);

  onLoad(() => {
    currentPageNumber.value = getCurrentPages().length;
    console.log(getCurrentPages(),'headerBar-onload')
  })
</script>

<style lang="scss" scoped>
  .nav-title {
    font-weight: normal;
    font-size: 32rpx;
  }
</style>
